package com.tengju.support.domain.model.robot;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum ChatType {

    PRIVATE("private"),
    GROUP("group"),
    ;

    private String val;

    @JsonValue
    public String getVal() {
        return val;
    }

    @JsonCreator
    public static ChatType fromVal(String val) {
        for (ChatType type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }
}
